<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">
        $(document).ready(function() {
            $("#AccountForm").validate({
            rules: {
                    SenderName: {
                        required: true
                    },
                    SenderEmail: {
                        required: true,
                        email: true
                    },
                    Subject: {
                        required: true
                    },
                    Body: {
                        required: true
                    }
                },
                messages: {
                    SenderName: {
                        required: "Sender name cannot be blank"
                    },
                    SenderEmail: {
                        required: "Sender email cannot be blank",
                        email: "Sender email must be valid"
                    },
                    Subject: {
                        required: "Subject cannot be blank"
                    },
                    Body: {
                        required: "Body cannot be blank"
                    }
                }
            });
        });
    </script>
    <h2>
        Send Mail</h2>
    <%= Html.ValidationSummary() %>
    <% using (Html.BeginForm("SendMail", "Account", FormMethod.Post, new { id = "AccountForm" }))
       { %>
    <fieldset>
        <legend>Send Mail</legend>
        <p>
            <label for="SenderName">
                Sender Name:</label>
            <%= Html.TextBox("SenderName")%>
            <%= Html.ValidationMessage("SenderName")%>
        </p>
        <p>
            <label for="SenderEmail">
                Sender Email:</label>
            <%= Html.TextBox("SenderEmail")%>
            <%= Html.ValidationMessage("SenderEmail")%>
        </p>
        <p>
            <label for="Subject">
                Subject:</label>
            <%= Html.TextBox("Subject")%>
            <%= Html.ValidationMessage("Subject")%>
        </p>
        <p>
            <label for="Body">
                Body:</label>
            <%= Html.TextArea("Body")%>
            <%= Html.ValidationMessage("Body")%>
        </p>
        <p>
            <input type="submit" value="Send Mail" />
            <input type="reset" value="Reset" />
        </p>
    </fieldset>
    <% } %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
